package com.czk.localdatetime;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/9/1 14:42
 */
public class MaxAndMinLocalDateTime {
    public static void main(String[] args) {
        // 计算最近三天
        LocalDate today=LocalDate.now();
        //
        LocalDate plus = today.plusDays(2);

        // 2022-06-14 00:00:00
        LocalDateTime todayTime=LocalDateTime.of(today, LocalTime.MIN);
        // 2022-06-17 23:59:59
        LocalDateTime plusTime = LocalDateTime.of(plus, LocalTime.MAX);

        String start = todayTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"));
        String end = plusTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"));

        System.out.println(start);
        System.out.println(end);
    }
}
